package cn.spring.ly.service.impl;

import cn.spring.ly.entity.SysPressm;
import cn.spring.ly.entity.SysUser;
import cn.spring.ly.mapper.SysUserDao;
import cn.spring.ly.service.SysPressmService;
import cn.spring.ly.service.SysUserService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ly
 * @since 2018-12-19
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUser> implements SysUserService {

	@Autowired
	SysPressmService pressmService;

	@Override
	public Set<String> getUserPressm(String username) {
		// TODO Aut
		QueryWrapper<SysUser> queryWapper = new QueryWrapper<SysUser>();
		queryWapper.eq(SysUser.USERNAME, username);
		// 从数据库获取对应用户名密码的用户
		SysUser user = getOne(queryWapper);

		Set<String> setPressm = new HashSet<>(pressmService.getPressmByUserId(user.getUserId()));
		return setPressm;
	}

}
